Structured Data¶

🧑🏽‍🍳 recipe.py¶

Write a program that allows the user to input a list of ingredients.

For each ingredient, they should provide the item, the quantity, and the units (e.g. cups, tsps, etc.)

Then query the user for the scaling factor (how much do they want to scale the recipe).

Then print out the recipe scaled by that factor. Round to 1 decimal place.

What ingredients are in your recipe?
Ingredient: flour
Quantity: 2
Unit: cups
Ingredient: salt
Quantity: 1
Unit: tbs
Ingredient: baking soda
Quantity: 1
Unit: tsps
Ingredient: water
Quantity: 1
Unit: cups
Ingredient: 
Scaling factor: 2.5
New Recipe:
  5.0 (cups) flour
  2.5 (tbs) salt
  2.5 (tsps) baking soda
  2.5 (cups) water

🎣 fishing.py¶

Write a program that allows the user to input information on a series of catches.

For each catch, the user should provide the place, type, and size (in inches) of the fish.

Then allow the user to specify which types of fish to report on. For each type specified, print a report indicating:

  • the total number of fish of that type
  • the average size of fish of that type (rounded to 1 decimal place)
  • the catch with the largest fish of that type
Place: Utah Lake
Type of fish: Trout
Size (inches): 6
Place: Lake Powell
Type of fish: Bass
Size (inches): 12
Place: Flaming Gorge
Type of fish: Bass
Size (inches): 18
Place: Strawberry
Type of fish: Trout
Size (inches): 13
Place: Bear Lake
Type of fish: Trout
Size (inches): 15
Place: 
What types of fish do you want to report on?
Type: Bass
Type: Trout
Type: 
Total # of Bass: 2
Average size for Bass: 15.0
Best Bass catch: 18.0 inches at Flaming Gorge
Total # of Trout: 3
Average size for Trout: 11.3
Best Trout catch: 15.0 inches at Bear Lake